package com.ruoyi.apis.controller;

import com.ruoyi.apis.entity.SysConfigEnity;
import com.ruoyi.apis.service.ISysConfigService;
import com.ruoyi.common.core.domain.AjaxResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.aspectj.weaver.loadtime.Aj;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author Choi
 * @Date 2021/10/15
 */

@Api(value = "配置", tags = "配置相关接口")
@RestController
@RequestMapping("/api")
public class IConfigContoller {

    @Autowired
    private ISysConfigService sysConfigService;

    /**
     * 清理缓存
     */
    @ApiOperation(value = "清理缓存")
    @GetMapping("/config/clear")
    public AjaxResult clear() {
        SysConfigEnity config = sysConfigService.getClearConfig();
        return AjaxResult.success(config);
    }

    /**
     * 更新已清缓存
     */
    @ApiOperation(value = "更新缓存已操作")
    @PutMapping("/config/clear")
    public AjaxResult updateClear() {
        sysConfigService.updateClearConfig();
        return AjaxResult.success();
    }
}
